#ifndef VECTOR_H_
#define VECTOR_H_
#include<iomanip>

class Vector {
private:
	int row;
	double *values;
public:
	Vector() {
	}
	Vector(int b) {
		row = b;
		values = new double[b + 1];
	}
	int Row() const{
		return row;
	}

	double & operator()(int i) {
		return values[i];
	}
	Vector operator+(const Vector &v) {
		Vector z = Vector(v.row);
		for (int i = 1; i <= z.row; i++)
			z.values[i] = values[i] + v.values[i];
		return z;
	}

	Vector & operator+=(const Vector &v) {
		for (int j = 1; j <= row; j++) {
			values[j] += v.values[j];
		}
		return *this;
	}
	Vector & operator-=(const Vector &v) {
		for (int j = 1; j <= row; j++) {
			values[j] -= v.values[j];
		}
		return *this;
	}
	Vector operator-(const Vector &v) {
		Vector z = Vector(v.row);
		for (int i = 1; i <= z.row; i++)
			z.values[i] = values[i] - v.values[i];
		return z;
	}
	Vector & operator*(const double &t) {
		for (int i = 1; i <= row; i++)
			values[i] = t * values[i];
		return *this;
	}

	Vector & operator/(const double &t) {
		for (int i = 1; i <= row; i++)
			values[i]/= t;
		return *this;
	}

	Vector operator=(const Vector &v) {
		row = v.row;
		values = v.values;
		return *this;
	}

	static Vector copyValueOf(Vector &v) {
		Vector vc = Vector(v.row);
		vc += v;
		return vc;
	}

	static Vector iso(int row, const double &v) {
		Vector vc = Vector(row);
		for (int i = 1; i <= vc.row; i++)
			vc.values[i] = v;
		return vc;
	}

	static Vector zeros(int row) {
		Vector v = Vector(row);
		for (int i = 1; i <= v.row; i++) {
			v.values[i] = 0;
		}
		return v;
	}

	void set(int i, const double &v){
		values[i]=v;
	}

	double * getValues() {
		return values;
	}

	virtual ~Vector(){}
};

#endif /* VECTOR_H_ */
